@use "theme" as *;
@use "vars" as *;
@use "mixins";
@use "sass:color";

// Top Banner
//------------------------------------------------------------------------------
.masthead {
  position: fixed;
  background: $masthead-background;
  top: 0;
  left: 0;
  width: 100vw;
  z-index: 1000000090;
  color: $elem-link-color;

  .container {
    position: relative;
    min-height: 49px;

    .branding {
      padding-top: 3px;
      margin-bottom: 0px;
      background: transparent;
      float: left;

      .branding-heading {
        margin-top: 7px;
        left: 20px;
        position: absolute;

        .logo {
          height: 23px;
          filter: invert(100%) brightness(80%);
          margin-left: -5px;
        }
      }

      .branding-label {
        margin: 5px auto auto 62px;
        display: inline-block;
        height: 28px;
        padding: 4px 0 0 15px;
        vertical-align: top;
        border-left: 1px solid rgba(255, 255, 255, 0.35);
        color: $main-homepage-icon-border;
        font-family: $font-branding;
        font-size: 18px;
        text-transform: none;
        -webkit-font-smoothing: antialiased;
        font-weight: 100;
        line-height: 26px;

        a:link, a:visited {
          color: $elem-link-color;
        }
        a:hover {
          color: $accent;
          cursor: pointer;
          text-decoration: none;
        }
      }
    }

    .user-tools {
      text-align: right;
      right: 10px;
      float: none;
      position: fixed;
      top: 9px;

      @include mixins.tablet{
        right: 20px;
      }
      @include mixins.desktop{
        right: 20px;
      }
    }
  }
}


// Breadcrumb
//------------------------------------------------------------------------------
.breadcrumb {
  padding-left: 8px;
  float: left;
  // padding-top: 1px;
  // display: inline-grid;
  margin: 15px 0;
  display: none;

  @include mixins.tablet{
    display: block;
  }
  @include mixins.desktop{
    display: block;
  }
}

.breadcrumb-item {
  display: inline-block;
  font-size: 15px;
  letter-spacing: 0.01em;
  line-height: 17px;

  a:hover {
      text-decoration: underline;
      outline: 0;
  }

  a:visited {
      color: $accent-light;
  }

  a:link {
      text-decoration: none;
      color: $accent-light;
  }
}

// Search
//------------------------------------------------------------------------------
.search-container {
  vertical-align: middle;
  white-space: nowrap;

  @include mixins.tablet{
    width: calc(100% - 20px);
  }
  @include mixins.desktop{
    width: calc(100% - 20px);
  }


  .tt-menu {
    background-color: inherit;
    border-color: $gray-40;
    border-style: solid;
    border-width: 0 1px 1px 1px;
    // compensate for border
    width: 100%;
    left: -1px !important;
  }

  .tt-suggestion {
    padding: 10px 15px;
    text-overflow: ellipsis;
    overflow: hidden;
    cursor: pointer;

    &:hover {
      background-color: $accent-light;
    }
  }

  .tt-cursor {
    background-color: $accent-light;
  }

  .twitter-typeahead {
    font-style: normal;
    font-family: $font-sans;
    font-size: 16px;
    line-height: 30px;
    font-weight: 400;
    position: relative;
    width: calc(100% - 65px);
    height: 50px;
    transition: background-color 0.3s;
    display: inline-block;
    border: 1px solid $gray-40;
    background: $white;
    -webkit-box-shadow: 5px 5px 0px 0px $gray-25;;
    -moz-box-shadow: 5px 5px 0px 0px $gray-25;;
    box-shadow: 5px 5px 0px 0px $gray-25;;
    color: $black;
    float: left;
    width: calc(100% - 20px);
    -webkit-transition: background .55s ease;
    -moz-transition: background .55s ease;
    -ms-transition: background .55s ease;
    -o-transition: background .55s ease;
    transition: background .55s ease;
    padding-left: 15px;
    -webkit-font-smoothing: antialiased;

    &:hover,
    &:focus,
    &:active {
      outline: none;
      background:  $accent-lightest;
    }


    .tt-hint {
      color: $gray-30;
      background-color: transparent !important;
      outline: none;
      border: none;
      -webkit-appearance: none;
      -webkit-font-smoothing: antialiased;
    }

    // to account for case where typeahead fails to load
    .twitter-typeahead.tt-input {
      box-shadow: none;
      border: none;
      padding-left: 0;
    }
  }


  .icon{
    position: relative;
    z-index: 10;
    border: none;
    background: $accent;
    height: 50px;
    width: 50px;
    top: 1px; // compensate for top border
    right: 1px; // compensate for right border
    color: $white;
    opacity: 1;
    font-size: 12pt;
    cursor: pointer;
    margin-left: -50px;
    -webkit-transition: opacity .35s ease;
    -moz-transition: opacity .35s ease;
    -ms-transition: opacity .35s ease;
    -o-transition: opacity .35s ease;
    transition: opacity .35s ease;
  }

  &:hover {
    .icon:hover {
      background: $accent;
    }
  }

  input::-webkit-input-placeholder,
  input:-moz-placeholder,
  input:-ms-input-placeholder  {
    color: $gray-45;
  }
  input:focus::-webkit-input-placeholder,
  input:focus:-moz-placeholder,
  input:focus:-ms-input-placeholder  {
    opacity: 0
  }
}

.additional-menus {
  clear: both;
  margin-top: 5px;
  display: flex;
  justify-content: space-between;
}


// User Tools
//------------------------------------------------------------------------------
#user-profile {
  a.btn-user-whole {
    &:link, &:visited {
      color: $elem-link-color;
      font-size: 15px;
      letter-spacing: 0.25px;
      padding: 17px 15px 16px 15px;
    }
    &:hover, &:active, &:target {
      text-decoration: none;
      background: color.scale($elem-active-link-color, $lightness: -30%);

      button.btn-user-initial {
        background: $black;
        color: $gray-50;
        border-color: $gray-30;
      }
    }
  }

  .user-fullname {
    margin-right: 5px;
    display: none;

    @include mixins.tablet{
      display: inline-block;
    }
    @include mixins.desktop{
      display: inline-block;
    }
  }

  button.btn-user-initial {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    position: relative;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    text-indent: -1px;
    background: $btn-user-initial;
    color: $gray-30;
    margin-right: 5px;
    line-height: 0px;
    text-align: center;
    border-color: $gray-80;
    padding: 0;
  }
}


.overlay {
	position: absolute;
	top: 0;
	bottom: 0;
  left: 0;
  right: 0;
	transition: opacity 100ms;
  visibility: hidden;
	opacity: 0;
  text-align: left;

  .cancel {
    position: fixed;
    width: 100vw;
    height: 100vh;
    cursor: default;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
  &:target {
    visibility: visible;
    opacity: 1;
  }
}

.popup {
  margin-top: 40px;
	padding: 0 20px 5px 20px;
  background-image: linear-gradient(215deg, $white 0%, $offwhite 100%);
	border: 1px solid #d4d4d4;
	width: 260px;
  float: right;
	position: relative;

  @include mixins.tablet{
    width: 300px;
    padding: 20px;
  }
  @include mixins.desktop{
    width: 300px;
    padding: 20px;
  }

  .close {
    position: absolute;
    width: 20px;
    height: 20px;
    top: 5px;
    right: 5px;
    opacity: 0.8;
    transition: all 200ms;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    color: $gray-30;
    &:hover {
      opacity: 1;
    }
  }

  h3 {
    margin: 10px auto 0px auto;
    color: $gray-20;
    border-bottom: 2px solid $gray-20;
    font-size: 16px;
    line-height: 30px;
    -webkit-font-smoothing: antialiased;

    @include mixins.tablet{
      margin: 10px auto;
      line-height: 32px;
    }
    @include mixins.desktop{
      margin: 10px auto;
      line-height: 32px;
    }
  }

  ul.recently-viewed-content, ul.most-viewed-content {
    margin: 0;
    padding: 0;
    list-style: none;

    li {
      a {
        color: $gray-20;

        &:hover {
          text-decoration: none;

          p {
            color: $black;
          }
        }
      }
      margin: 0px 0 5px 0;
      font-size: 15px;

      @include mixins.tablet{
        margin: 13px 0;
      }
      @include mixins.desktop{
        margin: 13px 0;
      }

      .docs-title {
        color: $accent;
        margin-bottom: 2px;
      }

      .docs-attr {
        margin:0;
      }
      .docs-folder {
        display: inline-block;
        margin-right: 4px;
        // background: if($light, $gray-60, $gray-80);
        background: $elem-link-color; // gray-50 and grey-80
        color: $gray-30;
        padding: 3px 4px;
        font-weight: 400;
        font-size: 12px;
        border-radius: 3px;

        &:empty {
          display: none;
        }
      }
      .timestamp {
        font-size: 12px;
        color: $gray-30;
      }
    }
  }

  .fa-spinner {
    width: 100%;
    margin: 20px 0;
    font-size: 32px;
    text-align: center;
  }
}


// the outer wrapper allows us to center the inner-wrapper, which itself
// fits exactly the image - so in effect, centering the inner wrapper
.image-wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;

  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center; 

  // The inner wrapper allows us to fit the button onto the bottom right
  // corner no matter the image dimenension
  .inner-wrapper {
    position: relative;
    width: min-content;

    .expand-image-btn {
      height: 60px;
      width: 60px;
      position: absolute;
      bottom: 30px;
      right: 10px;
      opacity: 0;
      transition: opacity 0.3s ease 0s;
      background-color: transparent;
      pointer-events: none;
      border: none;
    }

    &:hover {
      .expand-image-btn {
        opacity: 1;
      }
    }
  }
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 1000000090; /* search bar icon has z-index of 1*10 */
    inset: 0px; /* shorthand for top,right,bottom,left at the same time */
    overflow: hidden;
    background-color: rgb(255, 255, 255); /* full white allows images to pop */
    transition: display 0.2s ease 0s;
}

.image-modal .img-wrapper {
  display: flex;
  align-items: center;
  align-content: center;
  height: 100%;
  padding: 30px;

  .modal-image {
    margin: auto;
    display: block;
    max-width: 100%;
    max-height: 100%;
    cursor: default;
  }
}

.image-modal .close {
    display: flex;
    align-items: center;
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: transparent;
    cursor: pointer;
    border: 0.5px solid white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    transition: all 0.1s ease-in;
    padding: 0px;

    &:hover, &:focus {
        background-color: #f9f9f9;
        border-color: lightgray;
    }
}


